package com.bocom.hairy.crab.web.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName com.bocom.hairy.crab.web.config.OpenApiConfig <br/>
 * @Description: TODO          <br/>
 * @Author jiangshikun             <br/>
 * @Date 2025/9/3 下午2:21         <br/>
 * @Version V1.0
 * ----------------------------------------
 * （^-^）心即理，知行合--致良知 （^-^）
 * 邮 箱:duzhuai@live.cn
 * 地 址：北京市海淀区永澄北路2号
 **/
@Configuration
public class OpenApiConfig {

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("CRAB官方API文档")
                        .version("1.0.0")
                        .description("项目API文档"))
                .addSecurityItem(new SecurityRequirement().addList("CRAB"))
                .components(new Components()
                        .addSecuritySchemes("CRAB",
                                new SecurityScheme()
                                        .type(SecurityScheme.Type.HTTP)
                                        .scheme("bearer")
                                        .bearerFormat("JWT")));
    }
}
